package prefuse.decisiontree.api;


/**
 * A TreeNode is an element of a DecisionTree. A TreeNode will have a TreeNodeValue 
 * corresponding to its business value. A TreeNode may or may not have a source Edge, 
 * which is an Edge that has this node as its destination and a parent node as its source.
 * 
 * @author SaskTrav
 * @editor Wenyi An
 */
public interface TreeNode {
	 /**
     * method to return Node type
     * @return NodeType in String
     */
	public String getNodeType();
    /**
     * method to return terminal value
     * @return terminal value in double
     */
    public double getRollBackValue();
    /**
     * method to set terminal value
     * @param double that represents terminal value
     */
    public void setRollBackValue(double value); //check it
    
    /**
     * retrieve the TreeNodeID
     * @return
     */
    public int getTreeNodeID();
    /**
     * Indicate if the TreeNode is selected
     * @return
     */
    public boolean isSelected();

    /**
     * Assign the TreeNode as selected or not selected
     *  True = Selected
     *  False = Selected
     */
    public void setSelected(boolean newSelected);

    /**
     * Retrieve the Edge which connects this TreeNode to its parent TreeNode.
     * 
     * @return An Edge with this TreeNode as its destination. Will return NULL if no source Edge exists.
     * @see Edge
     */
    public Edge getSourceEdge();
    
    /**
     * Set a new source Edge for this TreeNode. The Edge must have this TreeNode as its destination.
     * 
     * @postcondition getSourceEdge returns the value provided as an argument
     * 
     * @param sourceEdge An Edge with this node as the destination.
     * @see Edge
     */
    public void setSourceEdge(Edge newSourceEdge) throws IllegalArgumentException;

    /**
     * Retrieve the time value in double format
     *
     * @postcondition the time returned must be >0
     *
     * @return a valid time in double format
     */
    public double getTime();

    /**
     * Retrieve the time value in double format
     *
     * @precondition the time must be >0
     * @param sourceEdge An Edge with this node as the destination.
     * @see Edge
     */
    public void setTime(double newTime) throws IllegalArgumentException;
    
    /**
     * Assigns the Variable name of the intermediate tree node
     * @precondition    the newVariableName must be a valid variable name from
     *                  the simulation list of variables
     */
    public void setVariableName(String newVariableName) throws IllegalArgumentException;

    /**
     * Retrieves the variable name of the intermediate tree node
     * @return  the variable name in the form of a string
     */
    public String getVariableName();
    
}
